import { BeanManagerCreator } from './modules/bean-manager';
import { TodoController } from './controllers/TodoController';
import { EventController } from './controllers/EventController';
import { TodoStore } from './stores/TodoStore';

const { BeanManager } = BeanManagerCreator({
  propertyKey: '__bean_property__'
});

const beanManager = new BeanManager({
  seeds: {},
  beans: [
    TodoController,
    EventController,
    TodoStore
  ]
});

// 初始化Bean管理器
beanManager.init();

// 获取控制器示例
const todoController = beanManager.getBean('todoController');
const eventController = beanManager.getBean('eventController');

// 使用示例
eventController.on('todo:added', (title) => {
  console.log(`新增待办事项: ${title}`);
});

todoController.addTodo('学习 TypeScript');
todoController.addTodo('学习 React'); 